//
//  main.m
//  03-HomeWork
//
//  Created by dllo on 16/7/7.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Book.h"
#import "BookManager.h"
int main(int argc, const char * argv[]) {
//    1.截取字符串 "20|https://www.baidu.com" 中 "|" 前面和后⾯的字符串, 并输出
//    2. 向可变数组里存储 int、float、double、BOOL类型等数据(不能使用字面量)
//    3. 实现图书管理系统(BookManager类)：
//      使用数组管理所有书籍(Book类)。
//      BookManager类属性数组可以添加、删除。
//      可以从数组根据书名查找书籍，并修改书籍的价格。
//      展示所有书籍清单（书名）
    NSString *string = @"20|https://www.baidu.com";
    NSArray *strArray = [string componentsSeparatedByString:@"|"];
    NSString *strFront = [strArray objectAtIndex:0];
    NSString *strLast = [strArray objectAtIndex:1];
    NSLog(@"%@, %@",strFront,strLast);
   
    
    
    int a = 2;
    float b = 3.22;
    double c = 3.22222;
    BOOL d = 1;
    
    NSNumber *oa = [NSNumber numberWithInt:a];
    NSNumber *ob = [NSNumber numberWithFloat:b];
    NSNumber *oc = [NSNumber numberWithDouble:c];
    NSNumber *od = [NSNumber numberWithBool:d];
    NSMutableArray *arr = [[NSMutableArray alloc]init];
    [arr addObject:oa];
    [arr addObject:ob];
    [arr addObject:oc];
    [arr addObject:od];
    NSLog(@"%@",arr);
    
    Book *book0 = [[Book alloc] initWithName:@"weicheng" book_price:34 id:0];
    Book *book1 = [[Book alloc] initWithName:@"redStarOverChina" book_price:90 id:1];
    Book *book2 = [[Book alloc] initWithName:@"economic" book_price:6 id:2];
    Book *book3 = [[Book alloc] initWithName:@"21century" book_price:31 id:3];
    Book *book4 = [[Book alloc] initWithName:@"sfsfs" book_price:89 id:4];
    
     //添加图书
    
    // 删除图书
    
    
    
    BookManager *manageBook = [[BookManager alloc]initWithBookMAnager];
    [manageBook addBook:book0];
    [manageBook addBook:book1];
    [manageBook addBook:book2];
    [manageBook addBook:book3];
    [manageBook addBook:book4];
    
    // 删除图书
    
    [manageBook removeBook:book0];
    // 修改
    [manageBook modifyBookPrice:@"economic" book_price:29];
  
    //显示所有图书
    [manageBook showBook];
       return 0;
}
